Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: reroute workspace main urls to the dashboard when workspace is stopped #1386

Closed
wants to merge 1 commit into from

Conversation

dkwon17
Copy link
Contributor

@dkwon17 dkwon17 commented May 16, 2022

Signed-off-by: David Kwon [email protected]

What does this PR do?

When a workspace is stopped, this PR updates the traefik such that the main url of the workspace is routed to the dashboard.

When the workspace is running, the traefik config looks like this: https://gist.githubusercontent.com/dkwon17/f094653c08776591924940c7f360b789/raw/5ed727aa13cd38dae925f57e4fc4d17416a5cca6/workspacestarted.yaml

When the workspace stops, this PR changes the traefik config to this: https://gist.githubusercontent.com/dkwon17/bcdece6b2d503c25df526496cf031992/raw/3a3487ea7ab30179bc694bf74a9622b1a48d489e/workspacestopped.yaml

In the new traefik config, the ReplacePathRegex middleware is used to change the workspace url path to a dashboard path.

Screenshot/screencast of this PR

In this gif we see that:

  1. Workspace is stopped
  2. IDE page is refreshed
  3. Instead of a 504 error, the user is redirected to the dashboard

updateroutes

What issues does this PR fix or reference?

Part of eclipse-che/che#20599. In another PR, maybe we can redirect the user to some error page provided by the dashboard.

How to test this PR?

Tested on CRC with the following:

  1. Deploy
chectl server:deploy \
     --platform crc\
     --che-operator-image quay.io/dkwon17/che-operator:updateroutes
  1. Open the dashboard with the URL provided by the output from chectl.
  2. Start a workspace, and wait until the editor opens.
  3. Stop the workspace.
  4. Refresh the editor. You should be redirected to the dashboard where you can start the workspace agian.

PR Checklist

As the author of this Pull Request I made sure that:

Reviewers

Reviewers, please comment how you tested the PR when approving it.

@openshift-ci
Copy link

openshift-ci bot commented May 16, 2022

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@openshift-ci
Copy link

openshift-ci bot commented May 16, 2022

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: dkwon17

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov
Copy link

codecov bot commented May 16, 2022

Codecov Report

Merging #1386 (a8cbf10) into main (a269da2) will increase coverage by 0.05%.
The diff coverage is 77.27%.

@@            Coverage Diff             @@
##             main    #1386      +/-   ##
==========================================
+ Coverage   61.89%   61.94%   +0.05%     
==========================================
  Files          76       76              
  Lines        6248     6309      +61     
==========================================
+ Hits         3867     3908      +41     
- Misses       1998     2013      +15     
- Partials      383      388       +5     
Impacted Files Coverage Δ
controllers/devworkspace/solver/solver.go 37.70% <50.00%> (+0.86%) ⬆️
pkg/deploy/gateway/traefik_config_util.go 82.25% <53.84%> (-7.54%) ⬇️
controllers/devworkspace/solver/che_routing.go 78.86% <92.59%> (+1.30%) ⬆️
controllers/usernamespace/controller.go 61.76% <0.00%> (-2.55%) ⬇️
...ploy/devfileregistry/devfileregistry_deployment.go 100.00% <0.00%> (ø)
.../deploy/pluginregistry/pluginregistry_configmap.go 69.23% <0.00%> (+2.56%) ⬆️
...eploy/devfileregistry/devfileregistry_configmap.go 69.23% <0.00%> (+2.56%) ⬆️
pkg/deploy/route.go 81.81% <0.00%> (+6.10%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a269da2...a8cbf10. Read the comment docs.

@dkwon17
Copy link
Contributor Author

dkwon17 commented May 16, 2022

This is a draft pull request for now, since I must still:

  1. Update the devworkspace-operator dependency
  2. Apply the new CheCluster api changes feat: CheCluster API v2  #1324

Copy link
Member

@ibuziuk ibuziuk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a great starting point. For future, we should probably create a dedicated page on the user dashboard with the possibility of restarting the workspace

@openshift-ci
Copy link

openshift-ci bot commented Jun 9, 2022

@dkwon17: PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@dkwon17
Copy link
Contributor Author

dkwon17 commented Jun 22, 2022

Closing in favour of #1392

@dkwon17 dkwon17 closed this Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants